#define _CRT_SECURE_NO_WARNINGS
#include "CaseSettings.h"

CaseSettings::CaseSettings()
{
	coordinateVertex0 = vector<double>(2, 0.0);
	coordinateVertex1 = vector<double>(2, 0.0);
	coordinateVertex2 = vector<double>(2, 0.0);
	coordinateVertex3 = vector<double>(2, 0.0);

	inletP = 101325.0;
	inletT = 298.15;
	inletMU = 1.837e-5;
	inletRho = 1.184;
}
CaseSettings::CaseSettings(string fileNames, string fileInlet0) {
	/* filename variables read in*/
	coordinateVertex0 = vector<double>(2, 0.0);
	coordinateVertex1 = vector<double>(2, 0.0);
	coordinateVertex2 = vector<double>(2, 0.0);
	coordinateVertex3 = vector<double>(2, 0.0);
	string localDirect = GetInputDirectory(fileNames);

	ifstream read_file_fileNames(localDirect);
	string s[8];
	assert(read_file_fileNames.is_open());
	read_file_fileNames >> s[0] >> coordinateVertex0[0];
	read_file_fileNames >> s[1] >> coordinateVertex0[1];
	read_file_fileNames >> s[2] >> coordinateVertex1[0];
	read_file_fileNames >> s[3] >> coordinateVertex1[1];

	read_file_fileNames >> s[4] >> coordinateVertex2[0];
	read_file_fileNames >> s[5] >> coordinateVertex2[1];
	read_file_fileNames >> s[6] >> coordinateVertex3[0];
	read_file_fileNames >> s[7] >> coordinateVertex3[1];
	read_file_fileNames.close();
	string localDirectInlet = GetInputDirectory(fileInlet0);
	ifstream read_file_fileNamesInlet(localDirectInlet);
	vector<string> s3(5);
	assert(read_file_fileNamesInlet.is_open());
	read_file_fileNamesInlet >> s3[0] >> inletP;
	read_file_fileNamesInlet >> s3[1] >> inletT;
	read_file_fileNamesInlet >> s3[2] >> inletMU;
	read_file_fileNamesInlet >> s3[3] >> inletRho;
	read_file_fileNamesInlet.close();
}
string CaseSettings::GetInputDirectory(string fileName)
{
	char homeDirect[1024];
	_getcwd(homeDirect, 1024);
	string localDirect = (string)(homeDirect)+(string)("\\LocalSettings\\") + fileName;
	return localDirect;
}
